<?php

namespace App\Http\Controllers\Wechat\Messages;

use Laravel\Lumen\Routing\Controller as BaseController;


/**
 * 纯文本消息
 * Class News
 * @package App\Http\Controllers\Wechat\Messages
 */
class Text extends BaseController
{
    public static function simple($textContent)
    {
        $text = new \EasyWeChat\Message\Text;

        $text->content = $textContent;

        return $text;
    }

    /**
     * 错误
     * @return \EasyWeChat\Message\Text
     */
    public static function serverWrong()
    {
        $text = new \EasyWeChat\Message\Text;

        $text->content = "服务器开小差了 ==! ";

        return $text;
    }

    /**
     * 微信消息 纯文本 注册(绑定)
     * @param $message
     * @return \EasyWeChat\Message\Text
     */
    public static function register($message)
    {
//        $url = route( 'register', ['openid' => $message->FromUserName] );

        $text = new \EasyWeChat\Message\Text;

//        $text->content = "  尚未绑定学号\n\n" . '<a href="' . $url . '">【点此绑定学号】</a>';
        $text->content = "=== 尚未绑定学号 ===\n\n回复: 绑定+学号+密码\n例: 绑定1305040301passwd";

        return $text;
    }


    /**
     * 等级成绩查询
     * @return \EasyWeChat\Message\Text
     */
    public static function scoreGrade()
    {
        $text = new \EasyWeChat\Message\Text;

        $text->content = "大学英语四六级成绩查询\n\n回复: cet+姓名+准考证号\n例: cet李白211070161201234";

        return $text;
    }


    /**
     * 四六级查询格式错误的返回信息
     * @return \EasyWeChat\Message\Text
     */
    public static function wrongCetQuery()
    {
        $text = new \EasyWeChat\Message\Text;

        $text->content = "未查询到成绩\n可能尚未公布成绩或格式有误, 请按此格式回复以查询\n\ncet李白211070161201234";

        return $text;
    }

    /**
     * 注册绑定时用户名或密码错误的返回信息
     * @return \EasyWeChat\Message\Text
     */
    public static function wrongRegister()
    {
        $text = new \EasyWeChat\Message\Text;

        $text->content = "学号或密码错误";

        return $text;
    }

    /**
     * 点击菜单 快递追踪 时返回的信息
     * @return \EasyWeChat\Message\Text
     */
    public static function express()
    {
        $text = new \EasyWeChat\Message\Text;

        $text->content = "试用快递实时追踪服务\n\n回复: 快递+单号+备注\n例0: 快递1151302195208\n例1: 快递1151302195208阿里云发票\n例2: 快递 1151302195208 阿里云发票\n\n备注的第一个字若为数字,请在单号与备注之间添加空格";

        return $text;
    }

    /**
     * 快件未追踪到状态
     * @param $url  string 手动打开快件追踪网页
     * @return \EasyWeChat\Message\Text
     */
    public static function wrongExpress($url)
    {
        $text = new \EasyWeChat\Message\Text;

        $text->content = "您的快件未追踪到\n可能单号错误或刚发货\n\n" . '<a href="' . $url . '">【点此查看快件详情】</a>';

        return $text;
    }

    /**
     * 快件已签收
     * @param $url
     * @return \EasyWeChat\Message\Text
     */
    public static function receiptExpress($data, $url)
    {
        $text = new \EasyWeChat\Message\Text;

        $text->content = "您的快件已经是签收状态\n\n$data\n\n" . '<a href="' . $url . '">【点此查看快件详情】</a>';

        return $text;
    }


    /**
     * 微信消息 纯文本 注册(绑定)
     * @param $message
     * @return \EasyWeChat\Message\Text
     */
    public static function registerNetwork($message)
    {
        $text = new \EasyWeChat\Message\Text;

        $text->content = "=== 未绑定校园网自助 ===\n\n回复: 网络 学号 密码\n例: 网络 1305040301 passwd\n注：不要忘记是有空格的～";

        return $text;
    }

    /**
     * 校园网自助服务 网络配置信息
     * @param $content
     * @return \EasyWeChat\Message\Text
     */
    public static function networkConfig($content)
    {
        $text = new \EasyWeChat\Message\Text;

        $text->content = "=== 校园网配置信息 ===\n\nIP：$content[0]\nMAC：$content[1]\n接入点：$content[3]\n类型：$content[4]\n";

        return $text;
    }

}
